package Day15;

import java.util.*;
// 1:无需package
// 2: 类名必须Main, 不可修改
/**
 * 2021Java真题:最大子矩阵
 * https://www.lanqiao.cn/problems/2147/learning/
 */
public class Main2 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int n = scan.nextInt();
        int m = scan.nextInt();
        int[][] arr = new int[n][m];
        for(int i = 0; i < n; i++){
          for(int j = 0; j < m; j++){
            arr[i][j] = scan.nextInt();
          }
        }

        int limit = scan.nextInt();
        int max = Integer.MIN_VALUE;
        for(int i = 0; i < n; i++){
          for(int j = 0; j < m; j++){
            for(int k = i; k < n; k++){
              for(int l = j; l < m; l++){
                if(f(arr,i,j,k,l) <= limit){
                  max = Math.max(max , (k - i + 1) * (l - j + 1));
                }else{
                  break;
                }
              }
            }
          }
        }
        System.out.println(max);
        scan.close();
    }

    public static int f (int[][] arr , int i , int j , int k, int l){
      int max = Integer.MIN_VALUE;
      int min = Integer.MAX_VALUE;
      for(int a = i; a <= k; a++){
        for(int b = j; b <= l; b++){
          max = Math.max(max , arr[a][b]);
          min = Math.min(min , arr[a][b]);
        }
      }
      return max - min;
    }
}